<%-- 
    Document   : home
    Created on : 16-nov-2011, 18:56:07
    Author     : JUAN
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <center>
    <body background="../../Recursos/Imagen/Portada/azul.jpg">
         <script language="javascript">

                            var delay=1000 //set delay in miliseconds
                            var curindex=0

                            var randomimages=new Array()

                                    randomimages[0]="../../Recursos/Imagen/Portada/camion.jpg"
                                    randomimages[1]="../../Recursos/Imagen/Portada/camion1.jpg"
                                    randomimages[2]="../../Recursos/Imagen/Portada/trailer.jpg"
                                    randomimages[3]="../../Recursos/Imagen/Portada/camion.jpg"
                                    randomimages[4]="../../Recursos/Imagen/Portada/trailer.jpg"
                                    randomimages[5]="../../Recursos/Imagen/Portada/trailer.jpg"
                            var preload=new Array()

                            for (n=0;n<randomimages.length;n++)
                            {
                                    preload[n]=new Image()
                                    preload[n].src=randomimages[n]
                            }

                            document.write('<img name="defaultimage" width="1000" height="300" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')

                            function rotateimage()
                            {

                            if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
                            curindex=curindex==0? 1 : curindex-1
                            }
                            else
                            curindex=tempindex

                                    document.images.defaultimage.src=randomimages[curindex]
                            }

                            setInterval("rotateimage()",delay)

                        </script>
    </body>
    </center>
</html>
